package ooday03;

public class Test {
    public static void main(String[] args) {
      /*  Dog xg=new Dog("小黑",3,"黑");
        xg.drink();
        xg.eat();
        xg.lookHome();
        xg.swim();



        Chick xj=new Chick("甜甜",2,"红");
        xj.drink();
        xj.eat();
        xj.layEggs();



        Fish xy=new Fish("小鲤鱼",1,"金");
        xy.drink();
        xy.eat();
        xy.swim();*/


        Dog dog=new Dog("小刘",7,"白");
        System.out.println(dog.name);
        //dog=null;//表示空，没有指向如何对象，若引用的值为null，则该引用不能再进行任何操作了，若操作发生NullPointerException空指针异常
        //System.out.println(dog.name);



        Dog[] dogs=new Dog[3];
        dogs[0]=new Dog("小黑",3,"黑");
        dogs[1]=new Dog("小白",2,"白");
        dogs[2]=new Dog("小黄",3,"黄");
        for (int i=0;i<dogs.length;i++){
            System.out.println(dogs[i].name);
            dogs[i].eat();
            dogs[i].drink();
            dogs[i].swim();
            dogs[i].lookHome() ;
        }




        Chick[] chicks=new Chick[3];
        chicks[0]=new Chick("小公",2,"褐");
        chicks[1]=new Chick("小母",1,"黄");
        chicks[2]=new Chick("小小",1,"白");
        for (int i=0;i<chicks.length;i++){
            System.out.println(chicks[i].name);
            chicks[i].eat();
            chicks[i].drink();
            chicks[i].layEggs();
        }




        Fish[] fish=new Fish[2];
        fish[0]=new Fish("小鲤鱼",2,"金");
        fish[1]=new Fish("小鲶鱼",4,"黑");
        for (int i=0;i<fish.length;i++){
            System.out.println(fish[i].name);
            fish[i].eat();
            fish[i].drink();
            fish[i].swim();
        }


    }
}
